

/* 
    Sharamag Publishing Engine Beta One
    This is released under the GPL License
    Version 1.0 beta by
    Gerry Straathof, 4 yr MADT student
    Alberta College of Art and Design

    Please assist with the development of this engine
    by making your enhancements part of the 
    ultimate Sharamag project.
    
    July 24, 2010.
    
    Developed for use with Sencha v 0.91
    http://www.sencha.com

*/
        

Ext.setup({
    
    tabletStartupScreen: 'tablet_startup.png',
    phoneStartupScreen: 'phone_startup.png',
    icon: 'icon.png',
    glossOnIcon: true,
    monitorOrientation: true,
    onReady: function() {
        
        // Create a Carousel of Items
        
        var publication = new Ext.Carousel({
            indicator: false,
            listeners: {
                afterrender: function(c){

                    c.body.on('click', function(e, t){
                        if(Ext.fly(t).hasClass('last')){
                            c.setCard(2);
                        }else{
                            c.setCard(0);
                        }
                    }, c, {delegate: 'a.move'}
                   
                    );
                }    
            },
        
            app: {},
            items: [{//this is a static image and cover title
                title: 'Tab 0',
                layout: 'fit',
                contentEl: 'backdrop1',
                items: [{// Don't scroll the Cover of the magazine
                // scroll: 'vertical',
                contentEl: 'c1'
                }]
            }, {//This article has one image throughout
                title: 'Tab 1',
                layout: 'fit',
                contentEl: 'backdrop2',
                items: [{
                scroll: 'vertical',
                contentEl: 'c2'
                }]
            }, { // This article has a changeable image
                title: 'Tab 2',
                layout: 'fit',
                items: [{
                scroll: 'vertical',
                contentEl: 'c3'
                }]
            },{ // this is empty 'article' to view images
                title: 'Tab 2',
                layout: 'fit',
            }, {// this article has no image set in it
                title: 'Tab 3',
                layout: 'fit',
                items: [{
                scroll: 'vertical',
                contentEl: 'c4'
                }]
            }, {// this article has an one image throughout
                title: 'Tab 4',
                layout: 'fit',
                contentEl: 'backdrop5',
                items: [{
                scroll: 'vertical',
                contentEl: 'c5'
                }]
            }]

        });
        
        /* hide the address bar */   
        window.scrollTo(0, 1); 
        
        new Ext.Panel({
            fullscreen: true,
            layout: {
                type: 'vbox',
                align: 'stretch'
            },
            defaults: {
                flex: 1
            },
            items: [publication]
        });
        Ext.getBody().unmask();
        }
});

